import React from 'react'
import ReactDOM from 'react-dom'
import { Spin } from 'antd'

let loading = null

export const showLoad = () => {
  if (!loading) {
    loading = document.createElement('div')
    loading.setAttribute('id', 'loading')
    document.body.appendChild(loading)
    ReactDOM.render(<Spin tip="加载中..." size="large" delay={100}></Spin>, loading)
  }
}

export const hideLoad = () => {
  if (loading) {
    // React.removeChild(loading)
    document.body.removeChild(loading)
    loading = null
  }
}
